@isTest(SeeAllData=true)
public class TestAttachCampaign_LeadOnUpload{
    private static testMethod void testInsert(){
        Test.startTest();
        Campus__c cmps = new Campus__c(Name = 'Unit Test', Active__c = True);
        cmps.recordTypeId = Schema.sObjectType.Campus__c.getRecordTypeInfosByName().get('West - Campus').getRecordTypeId();
        insert cmps;
        
        Program__c prgm = new Program__c(Name = 'Unit Test', Active__c = True);
        prgm.recordTypeId = Schema.sObjectType.Program__c.getRecordTypeInfosByName().get('West - Program').getRecordTypeId();
        insert prgm;
        
        Catalog__c ctlg = new Catalog__c(Catalog_Name__c = 'Unit Test', 
                                            Active__c = True, Campus__c = cmps.Id, Program__c = prgm.Id);
        ctlg.X3_Payments__c = true;
        ctlg.X4_Payments__c = true;
        ctlg.X5_Payments__c = true;
        ctlg.X10_Payments__c = true;
        ctlg.X11_Payments__c = true;
        ctlg.X12_Payments__c = true;
        ctlg.Early_Payoff__c = true;
        ctlg.recordTypeId = Schema.sObjectType.Catalog__c.getRecordTypeInfosByName().get('West').getRecordTypeId();
        insert ctlg;
        
        Campaign cm = new Campaign(Name = 'UnitTest');
        cm.RecordTypeId = Schema.sObjectType.Campaign.getRecordTypeInfosByName().get('West - Parent Campaign').getRecordTypeId();
        insert cm;

        Campaign cp = [Select Id , Name,CNID__C from Campaign where Name ='UnitTest' limit 1];        
        
        Lead ld = new Lead();
        ld.Web_to_Lead__c = 'WebRFI';
        ld.Campaign_Text__c = cp.CNID__c;
        ld.LastName = 'Test';
        ld.Campaign_Member_Status_Text__c='Test';
        ld.FirstName = 'Unit';
        ld.Phone = '1234567890';
        ld.Email = 'unit@test.method';
        ld.Home_Phone__c = '1234567890';
        ld.Campus__c = cmps.Id;
        ld.Program__c = prgm.Id;
        ld.Catalog__c = ctlg.Id;
        ld.recordTypeId = Schema.sObjectType.Lead.getRecordTypeInfosByName().get('West - Prospective Student').getRecordTypeId();
        ld.RFI_Country__c = 'United States';
        ld.Other_Country__c = 'United States';
        ld.Country = 'United States';
        insert ld;
        
        Test.stopTest();
    }
}